package org.forever.learn.function;



import jakarta.annotation.Resource;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.prompt.Prompt;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.ai.ollama.api.OllamaOptions;


import java.util.List;

@RestController
@RequestMapping("/ai/function")
public class FunctionCallController {
//    @Resource
//    ChatClient chatClient;

    @Resource
    OllamaChatModel ollamaChatModel;



    @GetMapping("/getDayBalance")
    public String chatWithFunction(@RequestParam String prompt, @RequestParam String sessionId) {
        return ChatClient.create(ollamaChatModel).prompt().user(prompt).functions("dayWeatherFunction","dayCountFunction").call().content();
//        return chatClient.prompt()
//                .user(prompt)
//                .functions()
//                .call()
//                .content();

    }

}
